<?php

class Kd_Data_Dcl_Fn {

    public static function count($field = '*'){
        $result = new Kd_Data_Dcl_Expression_Fn_Count();
        return $result->setField($field);
    }

    public static function max($field){
        $result = new Kd_Data_Dcl_Expression_Fn_Max($field);
        return $result->setField($field);
    }

    public static function addition($left, $right){
        return new Kd_Data_Dcl_Expression_Fn_Arithmetic($left, $right, '+');
    }

    public static function subtract($left, $right){
        return new Kd_Data_Dcl_Expression_Fn_Arithmetic($left, $right, '-');
    }

    public static function multiplication($left, $right){
        return new Kd_Data_Dcl_Expression_Fn_Arithmetic($left, $right, '*');
    }

    public static function division($left, $right){
        return new Kd_Data_Dcl_Expression_Fn_Arithmetic($left, $right, '/');
    }

    public static function modulo($left, $right){
        return new Kd_Data_Dcl_Expression_Fn_Arithmetic($left, $right, '%');
    }
    
    public static function stringSub($string, $position, $length = NULL){
    	return new Kd_Data_Dcl_Expression_Fn_String_Sub($string, $position, $length);
    }

    public static function stringLength($field){
    	return new Kd_Data_Dcl_Expression_Fn_String_Length($field);
    }
    
    public static function stringConcat(){
    	$args = func_get_args();
    	return new Kd_Data_Dcl_Expression_Fn_String_Concat($args);
    }    
}